#include <iostream>
#define N 100

using namespace std;

void LCS(int array[], int elements){
int maxarr[2] = {0,0}; // [0] == the number, [1] == the number of times seen
int tmp[2] = {0,0};

for(int i = 0; i < elements ;++i){
    tmp[0] = array[i];
    while(array[i] == tmp[0]){
        ++tmp[1]; // increment times seen
        ++i;}
    --i;
if(maxarr[1] < tmp[1]){
    maxarr[0] = tmp[0];
    maxarr[1] = tmp[1];
    tmp[0] = 0;
    tmp[1] = 0;}
	}
cout << "The number: " << maxarr[0] << ", seen: " << maxarr[1] << " times.\n";
}


void readVector(int array[], int elements){
for (int i=0; i<elements; i++){
	cout<<"a["<<i<<"]=";
	cin>>array[i];
	cout<<"\n";}
}

void printVector(int array[], int elements){
int i;
for (i=0; i<elements; i++){
    cout<<array[i]<<" ";}
	cout<<"\n";
}

int main(){
int array[N];
int elements;
int i;

cout<<"Type the number of elements you want in the array: ";
cin>>elements;
readVector(array,elements);

cout<<"The original array is: ";
for(int i=0; i<elements; i++){
	cout<<array[i]<<" ";}
cout<<endl;

LCS(array,elements);

return 0;
}
